package com.aishua.andpaydemo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.aishua.andpaydemo.fragment.BaseFragment;
import com.aishua.andpaydemo.utils.LogUtils;

import java.util.List;

/**
 * Created by aishua on 2018/5/16.
 */

public class CaifuAdapter extends FragmentPagerAdapter {
    private static final String TAG = "MainViewAdapter";
    private List<BaseFragment> fragmentList;
    private List<String> list_Title;

    public CaifuAdapter(FragmentManager fragmentManager, List<BaseFragment> fragmentList, List<String> list_Title) {
        super(fragmentManager);
        this.fragmentList = fragmentList;
        this.list_Title = list_Title;
        LogUtils.v(TAG + "fragmentList:" + fragmentList);
    }

    @Override
    public Fragment getItem(int position) {

        return fragmentList.get(position);
    }

    @Override
    public int getCount() {

        return fragmentList.size();
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    //此方法用来显示tab上的名字

    @Override
    public CharSequence getPageTitle(int position) {

        return list_Title.get(position % list_Title.size());
    }
}